<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
    <title>Editor</title>

    <script src="/soap/ajax/10.0/connection.js"></script>
    <script src="/soap/ajax/10.0/apex.js" type="text/javascript"></script>
    <script src="/js/dojo/0.4.1/dojo.js"></script>
    <script src="/js/functions.js"></script>

    <!-- Get the latest version number -->
    <script src="http://www.cheenath.com/ajaxtools/version-info.js"></script>

    <script type="text/javascript" >
        var pageUrls = {};
        pageUrls.loading = "@@:AJT_loading:@@";
        pageUrls.samples = "@@:AJT_samples:@@";
        pageUrls.debugshell = "@@:AJT_debugshell:@@";
        pageUrls.explorer = "@@:AJT_explorer:@@";
        pageUrls.docs = "@@:AJT_docs:@@";
        pageUrls.apexrunner = "@@:AJT_apexrunner:@@";
        pageUrls.editor = "@@:AJT_editor:@@";
        pageUrls.perf = "@@:AJT_perf:@@";
    </script>

    <script src="@@:AJT_editorscript:@@" type="text/javascript"></script>
    <script src="@@:AJT_template:@@" type="text/javascript"></script>

    <style type="text/css">
        body {
            font-family: Arial, Tahoma, Verdana;
            font-size: 10px;
        }

        img {
            border: 0;
        }

        a {
            color: #333;
        }

        a:hover {
            text-decoration: underline;
        }

        TABLE {
            border-collapse: collapse;
            border: 1px solid black;
            font-size: 12px;
        }

        *#col1 {
            border: 3px solid black;
        }

        TD.dotted-black {
            border: 0px dotted black;
            padding: 10px;
            text-align: center;
        }

        TD.solid-black {
            border: 2px solid black;
            padding: 1px;
        }

        TD.solid-green {
            border: 5px solid green;
        }
    </style>
</head>

<body onkeydown="return handleKeydown(event)" onresize="handleResize()" onunload="handleUnload(event)">

<div dojoType="PopupMenu2" widgetId="main-popup-menu" contextMenuForWindow="true">
    <div dojoType="MenuItem2" onClick="javascript:saveAndRun(true); void 0;" caption="Save And Run <Ctrl-;>"></div>
    <div dojoType="MenuItem2" onClick="javascript:save(); void 0;" caption="Save <Ctrl-s>"></div>
    <div dojoType="MenuItem2" onClick="javascript:runScontrol(); void 0;" caption="Run <Ctrl-e>"></div>
    <div dojoType="MenuItem2" onClick="javascript:execSelected(); void 0;" caption="Exec selected <Ctrl-enter>"></div>
    <div dojoType="MenuItem2" onClick="javascript:showShell(); void 0;" caption="Shell <Ctrl-d>"></div>
    <div dojoType="MenuItem2" onClick="javascript:showExplorer(); void 0;" caption="Explorer"></div>
    <div dojoType="MenuItem2" onClick="javascript:handleEscape(); void 0;" caption="Close <Esc>"></div>
</div>

<table width=100% cellspacing=0 cellpadding=2 style="border: 3px solid black">

    <tr>
        <td colspan=2>
            <table width="100%">
                <tr>
                    <!--
                    <td class="dotted-black" width=30>
                        <a href="javascript:showOpen(); void 0;">
                            <img src="/img/book_open.gif" width="24" height="24" alt="Open"></img></a><br>Open
                    </td>
                    -->
                    <td class="dotted-black" width=30>
                        <a href="javascript:save(); void 0;" id="save-tip">
                            <img src="/img/linkToPageFromConsole.GIF" width="24" height="24" alt="Save"></img></a><br>Save
                        <span dojoType="tooltip" style="display: none;" connectId="save-tip">Save SContro or Compile Apex classes <b>Ctrl-S</b> </span>
                    </td>
                    <td class="dotted-black" width=30>
                        <a href="javascript:saveAndRun(true); void 0;" id="run-tip">
                            <img src="/img/campaign_target_large.gif" width="24" height="24" alt="Run"></img></a><br>Run
                        <span dojoType="tooltip"  style="display: none;" connectId="run-tip">If the code is modified
                            then save it. <br> After saving, display SControl or Apex Test page <b>Ctrl-;</b></span>
                    </td>
                    <td class="dotted-black" width=30>
                        <a href="javascript:showNew(); void 0;" id="new-tip">
                            <img src="/img/hammer_page_icon.gif" width="24" height="24" alt="New"></img></a><br>New
                        <span dojoType="tooltip" style="display: none;" connectId="new-tip">Creates a new SControl or Apex class. </span>
                    </td>
                    <td class="dotted-black" width=30>
                        <a href="javascript:alert('todo'); void 0;" id="backup-tip">
                            <img src="/img/orders_page_icon.gif" width="24" height="24" alt="Backup"></img></a><br>Backup
                        <span dojoType="tooltip" style="display: none;" connectId="backup-tip">(todo)Backup selected scontrol/apex to a document folder</span>
                    </td>
                     <td class="dotted-black" width=30>
                        <a href="javascript:showConfig(); void 0" id="config-tip">
                            <img src="/img/listview_icon.gif" width="24" height="24" alt="Config"></img></a><br>Config
                         <span dojoType="tooltip" style="display: none;" connectId="config-tip">Open configuration window</span>
                    </td>
                     <td class="dotted-black" width=30>
                        <a href="javascript:showHelp(); void 0">
                            <img src="/img/help/helpTips_icon.gif" width="24" id="help-tip" height="24" alt="Help"></img></a><br>Help
                         <span dojoType="tooltip" style="display: none;" connectId="help-tip">Open Help window</span>
                    </td>
                     <td class="dotted-black" width=30> &nbsp; </td>
                    <td class="dotted-black" width=30> &nbsp; </td>
                    <td width=100%>&nbsp;</td>
                    <td class="dotted-black" width=30>
                        <a href="javascript:showShell(); void 0;">
                            <img id="shell-tip"src="/img/insect_page_icon.gif" width="24" height="24" alt="Shell"></img></a><br>Shell
                        <span dojoType="tooltip" style="display: none;" connectId="shell-tip">Open a debug shell that can execute JavaScript/Apex/SOQL/SOSL <b>Ctrl-D</b></span>
                    </td>
                    <td class="dotted-black" width=30>
                        <a href="javascript:showSamples(); void 0;">
                            <img src="/img/tools.gif" width="24" id="sample-tip" height="24" alt="Samples"></img></a><br>Samples
                        <span dojoType="tooltip" style="display: none;" connectId="sample-tip">Open a Samples browser with 50 live Samples</span>
                    </td>
                   <td class="dotted-black" width=30>
                        <a href="javascript:showExplorer(); void 0">
                            <img src="/img/radardish_page_icon.gif" id="explorer-tip" width="24" height="24" alt="Explorer"></img></a><br>Explorer
                       <span dojoType="tooltip" style="display: none;" connectId="explorer-tip">Open SOQL Explorer</span>
                    </td>
                    <td class="dotted-black" width=30>
                        <a href="javascript:showDocs(); void 0">
                            <img src="/img/solutions_page_icon.gif" id="docs-tip" width="24" height="24" alt="Docs"></img></a><br>Docs
                       <span dojoType="tooltip" style="display: none;" connectId="explorer-tip">Open Document Browser</span>
                    </td>
                    <td class="dotted-black" width=30>
                        <a href="javascript:showPerf(); void 0">
                            <img src="/img/solutions_page_icon.gif" id="perf-tip" width="24" height="24" alt="Perf"></img></a><br>Perf
                       <span dojoType="tooltip" style="display: none;" connectId="perf-tip">Open Performance monitor</span>
                    </td>
                    <td class="dotted-black" id="upgrade-button" style="color: red; display: none">
                        <a href="javascript:showVersion(); void 0">
                            <img src="/img/jewel.gif" id="upgrade-tip" width="24" height="24" alt="Upgrade"></img></a><br>Upgrade
                        <span dojoType="tooltip" style="display: none;" connectId="upgrade-tip">
                            A new version of AJAX Tools is available on AppExchange. <br>
                            Click this icon to view the ApexExchange page for the latest version.</span>
                    </td>

                    <!--
                    <td cellhalign="right">
                        <div halign="right" dojoType="SFProgressBar" widgetId="editor_progress"
                             numboxes="10" width="200" height="20" multiplier="200"
                             basecolor="#ccc" oldcolor="#666" hicolor="#00f">
                        </div>
                    </td>
                    -->
                </tr>
            </table>
        </td>
    </tr>

    <tr>
        <td class="solid-black" valign="top" id="open-pane-td">
            <div  id="open-pane">
                <!--
                <div align="right">
                    <a href="javascript: showOpen(); void 0;"> <img src="/img/arrow_lt.gif" alt="Hide"></img> </a>
                </div>
                -->
                <b>List of SControls:</b>
                <p>
                
                <div id="open-message" style="font-size: 100%; height: 600px; overflow:scroll; overflow-x: hidden" onkeydown="return handleKeydown(event)">
                    <div id="list"></div>
               </div>
            </div>
           <!--
            <div id="open-pane-more" style="display: none"><a href="javascript: showOpen(); void 0;">
                <img src="/img/arrow_rt.gif" alt="Show"></img>
            </a></div>
            -->

        </td><td class="solid-black" width="80%" id="text-area-td" valign="top">
            <iframe src="@@:AJT_loading:@@"
                    title="text-area-frame" hight="100%" width="100%" align="top"
                    frameborder="0" scorolling="no" id="text-area-frame"
                    name="text-area-frame"></iframe>
        </td>
    </tr>

    <tr bgcolor=#638658>
        <td colspan=2 halign="left">
            <b><span id="list-title"></span>: </b> <span id="scontrol-status"></span>
        </td>
    </tr>

</table>

<form name="display-form" id="display-form" onsubmit="return save()">
    <input type="hidden" name="scontrol-id" id="scontrol-id"/>
    <input type="hidden" name="scontrol-name" id="scontrol-name"/>
    <br>
</form>


<div dojoType="FloatingPane"
     id="template-list-pane"
     title="Select Template"
     constrainToContainer="true"
     hasShadow="false"
     windowState="minimized"
     displayMinimizeAction="true"
     displayCloseAction="false"
     toggle="explode"
     style="position: absolute; width: 300px; height: 450px; top: 100px; left: 120px; display:none">

    <h4>Please select template</h4>

    <div id="template-list" onkeydown="return handleKeydown(event)">
    </div>
</div>


<div dojoType="FloatingPane"
     id="template-option-pane"
     title="Template Wizard"
     constrainToContainer="true"
     hasShadow="false"
     windowState="minimized"
     displayMinimizeAction="false"
     displayCloseAction="false"
     toggle="explode"
     style="position: absolute; width: 500px; height: 300px; top: 200px; left: 200px; display:none">

        <form id="template-option-form" action="" onsubmit="validateOption(); return false;">
    <table width="100%">
        <tr><td><h5>Template Wizard</h5></td></tr>
        <tr><td><div id="template-option-question"></div></td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td align="center"><div id="template-option-answer"></div></td></tr>
        <tr><td>&nbsp;</td></tr>
        <tr><td align="right"><input type="button" onclick="javascript: validateOption(); void 0;"
                       name="Next" value="Next" /></td></tr>
   </table>
  </form>
</div>


<!--
<div dojoType="FloatingPane"
     id="help-pane"
     title="AJAX Tools Help"
     constrainToContainer="true"
     hasShadow="false"
     windowState="minimized"
     displayMinimizeAction="true"
     displayCloseAction="false"
     toggle="explode"
     style="position: absolute; width: 400px; height: 500px; top: 100px; left: 400px; display:none">

    <h4>AJAX Tools Help</h4>

    <div id="help-message" onkeydown="return handleKeydown(event)">
        <p>
        <table border="0">
        <tr><td><a href="javascript:save(); void 0;">Save</a></td><td> Ctrl-s</td></tr>
        <tr><td><a href="javascript:saveAndRun(true); void 0;">Save And Run</a></td><td> Ctrl-;</td></tr>
        <tr><td><a href="javascript:showShell(); void 0;">Shell</a></td><td> Ctrl-d</td></tr>
        <tr><td><a href="javascript:showExplorer(); void 0;">Explorer</a></td><td></td></tr>
        <tr><td><a href="javascript:handleEscape(); void 0;">Close</a></td><td> Esc</td></tr>
        <tr><td><font color="blue">Select All</font></td><td> Ctrl-a</td></tr>
        <tr><td><font color="blue">Copy</font></td><td> Ctrl-c</td></tr>
        <tr><td><font color="blue">Cut</font></td><td> Ctrl-x</td></tr>
        <tr><td><font color="blue">Paste</font></td><td> Ctrl-v</td></tr>
        <tr><td><font color="blue">Undo</font></td><td> Ctrl-z</td></tr>
        </table>
    </div>

</div>
-->

<div dojoType="FloatingPane"
     id="config-pane"
     title="Config"
     constrainToContainer="true"
     hasShadow="false"
     windowState="minimized"
     displayMinimizeAction="true"
     displayCloseAction="false"
     toggle="explode"
     style="position: absolute; width: 400px; height: 500px; top: 100px; left: 200; display:none">

    <h4>Configuration</h4>

    <div id="config-message" onkeydown="return handleKeydown(event)">
        <table>
            <tr><td>Id used for merge fields</td><td><input type="text" id="config-pane-eid" name="config-pane-eid" /></td></tr>
            <tr><td colspan="2" halign="center">
                <input type="button" value="Close" onClick="javascript: configDlg.hide(); void 0;" /></td></tr>
        </table>
   </div>

</div>


<div dojoType="FloatingPane"
     id="exec-pane"
     title="Exec Result"
     constrainToContainer="true"
     hasShadow="false"
     windowState="minimized"
     displayMinimizeAction="true"
     displayCloseAction="false"
     toggle="explode"
     style="position: absolute; width: 300px; height: 150px; top: 100px; left: 300px; display:none">

    Evaluation result:<br>

    <div id="msgdlg-message" onkeydown="return handleKeydown(event)"></div>

</div>

</body>
</html>

